﻿@{
    ViewBag.Title = "Index";
}

<h2>Donations</h2>

@if (ViewData["Message"] != null)
{
	<div>
	*** @ViewData["Message"] ***
	</div>
	<br />
}

<div id="DonationsContent">
@Html.CmsContent("donate")
</div>

<div id="DonateForm" style="padding:5px;overflow:auto;">
	<div id="DonateFormInner">
	<form method="post" action="@Url.Action("Index", "Donate")">
		<div>
			Please provide your contact information. Make sure your name corresponds 
			to the the name provided with your payment.
		</div>
	
		<table cellspacing="0">
			<thead></thead>
			<tbody>
				<tr>
					<td>Your First Name</td>
					<td>
						@Html.TextBox("FirstName")
					</td>
				</tr>
				<tr>
					<td>Your Last Name</td>
					<td>
						@Html.TextBox("LastName")
					</td>
				</tr>
				<tr>
					<td>Your Email Address</td>
					<td>
						@Html.TextBox("Email")
					</td>
				</tr>
				<tr>
					<td>Your phone number</td>
					<td>
						@Html.TextBox("Phone")
					</td>
				</tr>
			</tbody>
		</table>
		 <br />
	
		<div>
			I am paying by
		</div>
		<div>
			@Html.RadioButton("PaymentForm", "Online Donation") 
			Online Donation
		</div>
		<div>
			@Html.RadioButton("PaymentForm", "Check") 
			Check
		</div>
		<div>
			@Html.RadioButton("PaymentForm", "In-Kind Donation") 
			In-Kind Donation
		</div>
		<br />
	 
		<div>
			Please provide the recipient's information:
		</div>
		<table cellspacing="0">
			<thead></thead>
			<tbody>
				<tr>
					<td>First Name</td>
					<td>
						@Html.TextBox("RecipientFirstName")
					</td>
				</tr>
				<tr>
					<td>Last Name</td>
					<td>
						@Html.TextBox("RecipientLastName")
					</td>
				</tr>
			</tbody>
		</table>
		<br />
	 
		<div>
			Choose one of the following:
		</div>
		<div>
			<div>
			@Html.RadioButton("SendCardVia", "Mailing Address")
			I would like to send card via mail to
			</div>

			<table cellspacing="0">
				<thead></thead>
				<tbody>
					<tr>
						<td>Street</td>
						<td>
							@Html.TextBox("CardViaMailStreet")
						</td>
					</tr>
					<tr>
						<td>City</td>
						<td>
							@Html.TextBox("CardViaMailCity")
						</td>
					</tr>
					<tr>
						<td>State</td>
						<td>
							@Html.TextBox("CardViaMailState")
						</td>
					</tr>
					<tr>
						<td>Zip</td>
						<td>
							@Html.TextBox("CardViaMailZip")
						</td>
					</tr>
				</tbody>
			</table>

			<div>
				@Html.RadioButton("SendCardVia", "Email")
				I would like to send card via email to
			</div>
			<table cellspacing="0">
				<thead></thead>
				<tbody>
					<tr>
						<td>Email Address</td>
						<td>
							@Html.TextBox("CardViaEmailAddress")
						</td>
					</tr>
				</tbody>
			</table>
		</div>
		<br />
	 
		<div>
			<div>
				Please select one of the following to be included in the card:
			</div>
			<div>
				@Html.RadioButton("DonationMessage", "A donation has been made to " + Constants.OrgName + " on your behalf (no monetary value included)")
				A donation has been made to @Constants.OrgName on your behalf (no monetary value included)
			</div>
			<div>
				@Html.RadioButton("DonationMessage", "A donation has been made to " + Constants.OrgName + " in the amount of")
				A donation has been made to @Constants.OrgName in the amount of
				@Html.TextBox("DonationMessageDollarDonation", null, new { width = "50px" })
				on your behalf
			</div>
			<div>
				@Html.RadioButton("DonationMessage", "An item has been donated on your behalf to " + Constants.OrgName)
				An item has been donated on your behalf to @Constants.OrgName
			</div>
		</div>
		<br />
	 
		<div>
			Write a personal message to the recipient.  You may want to explain the reason for the gift, honorarium, or memorial.
			@Html.TextArea("PersonalMessage", "", 5, 50, null)
		</div>
		 <br />

		 <div id="ButtonsList">
			<input type="submit" value="Send Form" />
			<input type="button" value="Cancel" onclick="cancelDialog();" />
		</div>
	</form>
	</div>

	<div id="DonationButtons" style="display:none;">
		<h2>Make a donation</h2>
		<div>
			Your request has been submitted; you can now make a donation using the buttons below.
		</div>
		<br />

		<strong>One-time Donation</strong>
		<div>
			<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
				<input type="hidden" name="cmd" value="_s-xclick">
				<input type="hidden" name="hosted_button_id" value="DMKA2V2C2JT7Q">
				<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
				<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
			</form>
		</div>
		<br />

		<strong>Recurring Donation</strong>
		<div>
			<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
				<input type="hidden" name="cmd" value="_s-xclick">
				<input type="hidden" name="hosted_button_id" value="L5YZ882QLKQDW">

				<table>
					<tr><td><input type="hidden" name="on0" value=""></td></tr>
					<tr><td>
						<select name="os0">
							<option value="Option 1">Option 1 : $10.00USD - monthly</option>
							<option value="Option 2">Option 2 : $20.00USD - monthly</option>
							<option value="Option 3">Option 3 : $30.00USD - monthly</option>
							<option value="Option 4">Option 4 : $40.00USD - monthly</option>
							<option value="Option 5">Option 5 : $50.00USD - monthly</option>
							<option value="Option 6">Option 6 : $75.00USD - monthly</option>
							<option value="Option 7">Option 7 : $100.00USD - monthly</option>
						</select>
					</td></tr>
				</table>

				<input type="hidden" name="currency_code" value="USD">
				<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribe_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
				<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
			</form>
		</div>
		<br />

		<strong>Wish-List Donation</strong>
		<div>
			<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
				<input type="hidden" name="cmd" value="_s-xclick">
				<input type="hidden" name="hosted_button_id" value="DMKA2V2C2JT7Q">
				<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
				<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
			</form>
		</div>
	</div>

</div>

<script type="text/javascript">
	$(function () {
		$("#DonateForm").dialog({
			modal: true,
			autoOpen: false,
			height: 350,
			width: 700,
			minWidth: 600,
			maxWidth: 700,
			minHeight: 250,
			maxHeight: 350,
			close: function(e) {
				$("#DonateFormInner").show();
				$("#DonationButtons").hide();
			}
		});

		$("#DonateNowLink").click(function () {
			//$("#DonateForm").dialog("height", "350");
			$("#DonateForm").dialog("open");
		});

		$("#DonateForm").find("form:first").submit(function(e) {
			if (e.preventDefault)
				e.preventDefault();
			if (e.stopPropagation)
				e.stopPropagation();

			$.ajax({
				url:"@Url.Action("Index", "Donate")",
				type: "post",
				data: $(this).serialize(),
				success: function(data) {
					$("#DonateFormInner").hide("fast");
					$("#DonationButtons").show("fast");
				},
				error: function() {
					alert("An error occurred while trying to send the donation request.  Please try again.  If the problem persists, please email us directly at @Constants.DefaultEmail.");
				}
			});
		});
	});

	function cancelDialog() {
		$("#DonateForm").dialog("close");
	}

	
</script>